package net.seehealth.healthpad.ui.view;

import java.util.List;

import net.seehealth.healthpad.Constants.Main;
import net.seehealth.healthpad.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;


public class MainListItemView extends LinearLayout {

	/** 要显示在的上下文*/
	private Context mContext;
	
	/** 要显示的背景*/
	private LinearLayout mLayout;
	
	/** 模块标识 **/
	private int type;
	
	
	/**
	 * 构造方法
	 * @param context 当前上下文
	 */
	public MainListItemView(Context context, int type) {
		super(context);
		mContext = context;
		this.type = type;
		initialize();
	}
	
	/**
	 * 初始化
	 */
	private void initialize() {
		View view = LayoutInflater.from(mContext).inflate(
        		R.layout.main_list_item, null);
		mLayout = (LinearLayout) view.findViewById(R.id.ll_main_list);
		
		LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
				LayoutParams.MATCH_PARENT,
				LayoutParams.WRAP_CONTENT);
		
		switch (type) {
		case Main.ANNOUNCE:		// 系统公告
			
			break;
		case Main.MESSAGE:		// 健康宣教

			break;
		default:
			break;
		}
		
		addView(view, lp);
	}
	
	/**
	 * 设置当前Item的值
	 * @param content 显示的内容
	 */
	public void updateView(List<String> content, int position) {
		if(position % 2 == 0){
			mLayout.setBackgroundResource(R.drawable.main_notice_list_item_bg);
		} else {
			mLayout.setBackgroundResource(R.drawable.main_notice_list_item_bg2);
		}
	}

}
